<template>
  <div class="my container">
    <header>
      <div class="user-info" v-if="loginStatus">
        <img :src="userInfo.imgUrl" alt="">
        <span>{{userInfo.NickName}}</span>
      </div>
      <div class="login" v-else @click="goLogin" >登录/注册</div>
    </header>
    <section>
      <ul>
        <li>地址管理</li>
        <li v-if="loginStatus" @click="loginOut">退出登录</li>
      </ul>
    </section>
    <TabbaR></TabbaR>
  </div>
</template>

<script>
import {mapMutations, mapState} from 'vuex'
import TabbaR from '@/components/common/TabbaR.vue'
export default {
  name: "MyS",
  components:{
    TabbaR
  },
  created(){
    console.log('@',this.userInfo);
  },
  computed:{
    ...mapState({
      loginStatus:state=>state.user.loginStatus,
      userInfo:state=>state.user.userInfo
    })
    
  },
  methods:{
    goLogin(){
      this.$router.push('/login')
    },
    //退出登录
    ...mapMutations(['loginOut']),
  }
};
</script>

<style scoped lang="scss"> 
.my{
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
header{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 4.2666rem;
  background-color: #b0352F;
  .login{
    padding:0.16rem 0.4rem ;
    font-size: 0.42666rem;
    color: #fff;
    background-color: #f6ab32;
    border-radius: 6px;
  }
  .user-info{
    display: flex;
    flex-direction: column;;
    justify-content: center;
    align-items: center;
    img{
      width: 1.76rem;
      height: 1.76rem;
      border-radius: 50%;
    }
    span{
      padding: 0.5333rem 0;
      font-size: 0.48rem;
      color:#fff;
    }
  }
}
section{
  flex:1;
  overflow: hidden;
  ul li{
    flex: 1;
    overflow: hidden;
    padding: 0.4rem;
  }
}
</style>
